package com.cuit.jifver.weibo.data;

import android.content.Context;

import com.cuit.jifver.weibo.inter.MyWeibo;
import com.cuit.jifver.weibo.model.TextMessage;
import com.cuit.jifver.weibo.net.OAuth;
import com.cuit.jifver.weibo.net.SyncHttp;
import com.cuit.jifver.weibo.util.Constants;

public class SinaWeibo implements MyWeibo {

	@Override
	public String publishTextMessage(Context context, TextMessage message) {
		WeiboParameters parameters = new WeiboParameters();
		parameters.add("status", "test");
		String str = null;
		try {
			str = OAuth.getPostParams(Constants.sina.URL_PUBLISH_TEXT_MESSAGE, "POST", parameters,Weibo.APP_SECRET, weibo.getAccessToken().getSecret());
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		SyncHttp http = new SyncHttp();
		try {
			str = http.httpPost(Constants.sina.URL_PUBLISH_TEXT_MESSAGE, str);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return str;
	}

}
